﻿@using Dentiste.Domain
@using Dentiste.Domain.Interfaces
@model Dentiste.Domain.Interfaces.IRow

@{
    Layout = null;
}

@if (Model.Id == 0)
{
    // Create a new empty row
    <div class="row">
        <div class="span3">
            @{
                string today = String.Format("{0:dd-MM-yyyy}", DateTime.Now);
            }
            <div class="input-append date" id="dp3" data-date-format="dd-MM-yyyy">
                <input class="span2" size="16" type="text" value="@today" id="datepicker-button">
                <span class="add-on"><i class="icon-calendar"></i></span>
            </div>
        </div>
        <div class="span3">
            @{
                DbSetCustom<IInami> allInami = new DentisteManager().SelectAllInami();
            }
            <select class="selectpicker" id="inamiPicker">
                @foreach (IInami inami in allInami)
                {
                    <option value="@inami.Code">@inami.Code - @inami.Label</option>
                }
            </select>
        </div>
        <div class="span3">
            <a id="tooth-picker-btn" href="#tooth_picker_modal" role="button" class="btn" data-toggle="modal">Choisir une dent</a>
            <input id="toothPlaceholder" disabled="disabled"/>
        </div>
    </div>
}
else
{
    // Render an existing row according to Model data
    // Create a new empty row
    <div class="row" id="@Model.Id">
        <div class="span3">
            @{
                string date = String.Format("{0:dd-MM-yyyy}", Model.Date);
            }
            <input class="span2" size="16" type="text" value="@date">
        </div>
        <div class="span3">
            @{
                DbSetCustom<IInami> allInami = new DentisteManager().SelectAllInami();
            }
            <select class="selectpicker">
                @foreach (IInami inami in allInami)
                {
                    <option @(inami.Code == Model.Inami.Code ? "selected=\"selected\"" : "")>@inami.Code - @inami.Label</option>
                }
            </select>
        </div>
        <div class="span1">
            <input type="text" class="toothSelected" value="@Model.ToothNumber"/>
        </div>
        <div class="span3">
            <a href="#@Model.Id" class="removeToken"><i class="icon-remove"></i></a>
            <div class="loaderContainer">
                <div class="loader" id="loader@(Model.Id)">
                    <p>
                        Suppression en cours ...
                    </p>
                    <div class="ball"></div>
                </div>
            </div>
        </div>
    </div>
}